<script setup>
import MoonNav from '@/components/MoonNav.vue';
import MoonBaner from '@/components/MoonBaner.vue';
import { getTimeLine } from '@/api/timeline';
import { ref } from 'vue'


import { getList } from '@/api/swiper'
const list = ref()
getList().then((res) => {
  list.value = res.data
  console.log(list.value)
})

const timeline = ref()
const render = async () => {
  const res = await getTimeLine()
  timeline.value = res.data
  console.log(res.data)
}

render()
</script>
<template>
  <!-- 导航模块 start-->
  <MoonNav></MoonNav>
  <!-- 导航模块 end -->
  <!-- 栏目模块 start -->
  <MoonBaner></MoonBaner>
  <div class="pic">
    <img v-for="item in list" :src="item.url" alt="">
  </div>
  <!-- 时间线  start-->
  <div class="moon-line">
    <div class="line-hd">
      <div><i class="iconfont icon-shijian"></i>流逝的时间</div>
      <div>更多&gt;&gt;</div>
    </div>
    <div class="line-bd">
      <el-timeline style="max-width: 600px">
        <!-- 每一项 -->
        <el-timeline-item :timestamp="item.time" placement="top" v-for="item in timeline">
          <el-card>
            <h4 class="line-title">{{ item.title }}</h4>
            <div class="line-box">
              <p>{{ item.text }}</p>
              <img class="line-img" :src="item.imgs" alt="">
            </div>
            <p>Tom committed {{ item.time }}</p>
          </el-card>
        </el-timeline-item>
      </el-timeline>
    </div>
  </div>
  <!-- 时间线  end-->

</template>

<style lang="less" scoped>
/* 旋转木马 */
.pic {
  position: relative;
  /* 开启弹性盒子 */
  display: flex;
  width: 350px;
  height: 200px;
  /* 头部给300px */
  margin: 50px auto 0px;
  /* 开启3d */
  transform-style: preserve-3d;
  animation: action 20s linear infinite;

  // 旋转图
  img {
    position: absolute;
    width: 350px;
    height: 200px;
    /* 添加阴影 */
    -webkit-box-reflect: below 15px -webkit-linear-gradient(transparent 10%, rgba(255, 255, 255, .3));
    border-radius: 5px;

    &:nth-child(1) {
      transform: rotateY(360deg) translateZ(500px);
    }

    &:nth-child(2) {
      transform: rotateY(60deg) translateZ(500px);
    }

    &:nth-child(3) {
      transform: rotateY(120deg) translateZ(500px);
    }

    &:nth-child(4) {
      transform: rotateY(180deg) translateZ(500px);
    }

    &:nth-child(5) {
      transform: rotateY(240deg) translateZ(500px);
    }

    &:nth-child(6) {
      transform: rotateY(300deg) translateZ(500px);
    }
  }

  .bgcolor {
    background: #fff;
  }

  @keyframes action {

    0% {
      transform: rotateY(0deg);

    }

    100% {
      transform: rotateY(360deg);

    }
  }
}








/* 时间线 start */

.moon-line {
  width: 50%;
  // height: 500px;
  margin: 160px auto;
  // background: linear-gradient(to right, rgb(169, 81, 169), #000);


  .line-hd {
    width: 100%;
    height: 40px;
    background: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 16px;

    i {
      margin-right: 10px;
    }
  }

  // 时间盒子
  .line-bd {
    width: 100%;
    margin-top: 10px;
    padding-left: 80px;


    // 每一项 未添加


    // 每个盒子标题
    .line-title {
      text-align: center;
      height: 20px;
    }

    .line-box {
      display: flex;
      justify-content: space-between;

      p {
        margin: 10px 0px;
      }

      .line-img {

        height: 100px;
        margin-top: 10px;
        margin-left: 10px;
      }
    }
  }

}

/* 时间线 end */
</style>